package cn.ithers.blog.dao;

import cn.ithers.blog.pojo.FriendLink;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author: zhanghuan
 * @date: 2020/9/30 12:06
 * @description:
 */
public interface FriendLinkDao extends JpaSpecificationExecutor<FriendLink> , JpaRepository<FriendLink,String> {
    FriendLink findOneById(String id);

    int deleteAllById(String id);

    @Query(nativeQuery = true, value = "select *from tb_friends where state = ? order by create_time DESC ")
    List<FriendLink> listFriendLinkByState(String state);
}
